package per.sunmes.cl.g.listeners;

import per.sunmes.cl.g.actor.ef.BlendDraw;

import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Touchable;

public class BtnColorChangeListener extends InputListener {

	BlendDraw blendDraw;
	Actor target;

	@Override
	public boolean touchDown(InputEvent event, float x, float y, int pointer,
			int button) {
		target = event.getListenerActor();
		if (blendDraw == null) {
			blendDraw = new BlendDraw(target);
			target.getParent().addActor(blendDraw);
			blendDraw.setZIndex(target.getZIndex() + 1);
			blendDraw.setTouchable(Touchable.disabled);
		}
		blendDraw.setVisible(true);
		return true;
	}

	@Override
	public void touchUp(InputEvent event, float x, float y, int pointer,
			int button) {
		blendDraw.setVisible(false);
		if (x >= 0 && x <= target.getWidth() && y >= 0
				&& y < target.getHeight()) {
			btnClick();
		}
	}

	public void btnClick() {

	}
}
